<!--
 * @Author: ckk
 * @Date: 2022-08-15 17:33:04
 * @LastEditors: ckk
 * @LastEditTime: 2022-08-25 17:33:25
 * @Description: 一行三个
-->
<template>
  <div class="two-content" :style="{ marginTop:datas.pageMargin,marginBottom:datas.pageMargin}">
    <div
      class="content-item"
      v-for="(item, index) in datas.imageList"
      :key="index"
      :style="{
        borderRadius: datas.borderRadius + 'px',
      }"
    >
      <div class="content-img">
        <img :src="item.coverUrl" alt="" @click="toLink(item.url)" />
        <div class="study-num">
          <img src="../../../assets/images/rightstop.png" alt="" />
          <span>{{datas.count}}人已学</span>
        </div>
      </div>
      <p class="content-title" :style="{ fontWeight: datas.textWeight }">
        <span>{{ item.name }}</span>
      </p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'twoContent',
  props: {
    datas: Object
  },
  data () {
    return {};
  },
  methods: {
    toLink (url) {
      if (url && url !== '') {
        window.location.href = url;
      }
    }
  }
};
</script>

<style scoped lang="scss">
.two-content {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  padding: 0 16px;
  justify-content: space-between;
  .content-item {
    width: 30%;
    // height: 140px;
    background: #ffffff;
    margin-bottom:10px;
  }
  .content-img {
    width: 100%;
    height: 103px;
    position: relative;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .study-num {
    position: absolute;
    left: 2px;
    bottom: 2px;
    width: auto;
    padding:4px 8px;
    background: rgba(0,0,0,0.4000);
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 8px;
      height: auto;
      display: block;
    }
    span {
      margin-left: 5px;
      font-size: 10px;
      font-weight: 800;
      color: #ffffff;
    }
  }
}
.content-title {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 20px;
  font-size: 14px;
  padding: 10px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.65);
  span{
    width:100%;
    overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
  }
}
</style>
